<template>
  <div class="center">
    <div v-if="Userdata.length">
      <div class="item" v-for="n in Userdata" :key="n.id">
      <div class="time">
        <img src="@/assets/time.svg" alt="">
        <span>{{n.commentTime| gettime }}</span>
      </div>
      <div class="content">
        {{n.comment_message}}
      </div>
      <div class="reply">
        回复帖子: {{n.article_title}}
      </div>
    </div>
    <div class="more">
    <button class="btn">没有更多数据了</button>
    </div>
    
    </div>
    <div v-else class="false">
      <img src="@/assets/NotFound.png" alt="">
      <p>暂时没有回复哟</p>
    </div>
  </div>
</template>

<script>
  export default {
    mounted(){
      let id = this.$route.query.id
      this.axios.get('/user/commentList?id='+id).then(res=>{
        console.log(res.data)
        this.Userdata.push(...res.data.data)
      })
    },
    data() {
      return {
        Userdata:[],
      }
    },
    filters:{
      gettime(value){
        let w = new Date(value)
        let m = w.getMonth()+1
        let d = w.getDate()
        return m + '-'+ d
      }
    }
  }
</script>

<style scoped>
.center{
  /* background: black; */
  width: 100%;
  /* height: 100px; */
}
.item{
  padding: 10px 24px;
  border: 1px solid #f0f0f0;
}
.time{
  display: flex;
  /* align-items: center; */
  font-size: 14px;
  color:#999;
  margin-bottom:16px;
}
.time img{
  width: 20px;
  margin-right: 10px;
}
.content{
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.reply{
  padding: 10px 20px;
  background: #f7f8fc;
  color: #999;
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-bottom: 16px;
}
.more{
  text-align: center;
  padding: 10px;
}
.btn{
  width: 30%;
  border: 0;
  background: #4cc3ff;
  color: white;
  line-height: 50px;
  border-radius: 10px;
}
.false{
  padding: 20px;
  text-align: center;
  color: #999;
  font-size: 14px;
}
.false img{
  width: 30%;
  margin-bottom: 10px;
}
</style>